<!DOCTYPE html>
<html>
	<head>

		<title>Charting</title>

		<!-- Fix for iOS Safari zooming bug -->
		<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0">
<style>
		.sTradingviewView {
			height: calc(100% - 88px);
		}
</style>
		<script type="text/javascript" src="charting_library/charting_library.standalone.js"></script>
		<!-- 		<script type="text/javascript" src="datafeeds/udf/dist/bundle.js"></script> -->
<script>
	var datafeeds ={
	    onReady: (callback) => {
	        console.log('[onReady]: Method call');
	    },
	    searchSymbols: (userInput, exchange, symbolType, onResultReadyCallback) => {
	        console.log('[searchSymbols]: Method call');
	    },
	    resolveSymbol: (symbolName, onSymbolResolvedCallback, onResolveErrorCallback, extension) => {
	        console.log('[resolveSymbol]: Method call', symbolName);
	    },
	    getBars: (symbolInfo, resolution, periodParams, onHistoryCallback, onErrorCallback) => {
	        console.log('[getBars]: Method call', symbolInfo);
	    },
	    subscribeBars: (symbolInfo, resolution, onRealtimeCallback, subscriberUID, onResetCacheNeededCallback) => {
	        console.log('[subscribeBars]: Method call with subscriberUID:', subscriberUID);
	    },
	    unsubscribeBars: (subscriberUID) => {
	        console.log('[unsubscribeBars]: Method call with subscriberUID:', subscriberUID);
	    },
	};
</script>
		<script type="text/javascript">
			function getParameterByName(name) {
				name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
				var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
					results = regex.exec(location.search);
				return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
			}

			function initOnReady() {
				//初始化
				// var datafeedUrl = "https://demo-feed-data.tradingview.com";
				// var customDataUrl = getParameterByName('dataUrl');
				// if (customDataUrl !== "") {
				// 	datafeedUrl = customDataUrl.startsWith('https://') ? customDataUrl : `https://${customDataUrl}`;
				// }
				var symbol=getParameterByName('symbol');
				var interval=getParameterByName('interval');
				var widget = new TradingView.widget({
					container_id: self.domId, //`id`属性为指定要包含widget的DOM元素id。
					symbol: symbol,
					interval: interval,
					locale: "en", //  语言
					autosize: true,
					fullscreen: false, //是否占用视图所有空间
					preset: "mobile",
					toolbar_bg: "#1e2235", //背景色
					datafeed: datafeeds,
					timezone: "Asia/Shanghai", //默认时区
					library_path: "charting_library/", //默认脚本核心文件存储位置
					indicators_file_name: "custom-study(MACD).js",
					drawings_access: {
						type: "black",
						tools: [{
							name: "Regression Trend"
						}],
					},
					//配置项
					enabled_features: [
						"adaptive_logo", //小屏幕上隐藏 'charts byTradingView' 文本
						"dont_show_boolean_study_arguments", //是否隐藏指标参数
						"hide_last_na_study_output", //隐藏最后一次指标输出
						"move_logo_to_main_pane", //logo在中间位置
						"same_data_requery", //允许您使用相同的商品调用 setSymbol 来刷新数据
						"hide_left_toolbar_by_defaul", //第一次打开图表时隐藏左工具栏
						"side_toolbar_in_fullscreen_mode", //使用此功能，您可以在全屏模式下启用绘图工具栏
						"disable_resolution_rebuild", //显示的时间与得到的数据时间一致
						"seconds_resolution", //支持秒的周期
						// 'hide_last_na_study_output', // 隐藏指标后面的 n/a
					],
					disabled_features: [
						"widget_logo",
						"symbol_info", //商品信息对话框
						"timezone_men", //商品信息对话框禁用时区上下文菜单
						"go_to_date", //前往到（选时间段）
						"compare_symbol", //菜单中删除“比较/覆盖”对话框
						"left_toolbar", //左侧工具栏
						"pane_context_menu", //图标右键菜单
						"volume_force_overlay", //在主数据列的同一窗格上放置成交量指示器  防止他们重叠
						"pane_context_menu",
						"contextmenu",
						"scales_context_menu",
						"legend_context_menu",
						"display_market_status",
						"timeframes_toolbar", //底部时间栏
						"snapshot_trading_drawings", //包含屏幕截图中的订单/位置/执行信号
						"use_localstorage_for_settings", //允许将用户设置保存到localstorage
						"header_symbol_search", //搜索框
						"header_undo_redo", //头部左右箭头
						"header_compare", //头部对比信息按钮
						"header_settings", //设置按钮
						"header_resolutions", //时间选择、分时切换
						"header_screenshot", //截图相机
						'header_chart_type', // k线样式
						'property_pages', // 禁用所有属性页
						// "header_fullscreen_button", //全屏按钮
						// "header_indicators", //指标
						// "header_chart_type",//图表类型切换
					],
					studies_overrides: {
						//柱状图颜色
						"volume.volume.color.0": "rgba(255, 15, 93,0.6)", //第一根的颜色
						"volume.volume.color.1": "rgba(21,195,34,0.6)", //第二根的颜色
						// "volume.volume.transparency": 70,    //透明度
						// "volume.volume ma.color": "#FF0000", //波浪图颜色
						// "volume.volume ma.transparency": 30， //波浪图透明度
						// "volume.volume ma.linewidth": 5,    
						// "volume.show ma": true,    //是否显示
						// "volume.options.showStudyArguments": false,
						// "bollinger bands.median.color": "#33FF88",
						// "bollinger bands.upper.linewidth": 7
						//MACD样式
						// "MACD.MACD.color": "#F00",
						// "MACD.Signal.color": "#fe8",
						// "MACD.Histogram.color": "#0f0",
						// 'MACD.MACD.linewidth': 1,
					},
					overrides: {
						//主要配置
						"symbolWatermarkProperties.color": "rgba(0,0,0, 0)",
						"paneProperties.background": "#20334d",
						"paneProperties.vertGridProperties.color": "#344568",
						"paneProperties.horzGridProperties.color": "#344568",
						"paneProperties.crossHairProperties.color": "#58637a",
						"paneProperties.crossHairProperties.style": 2,
						// 数据列风格。 请参阅下面的支持的值
						//  Bars = 0            #美国线
						//  Candles = 1         #K线图
						//  Line = 2            #线形图
						//  Area = 3            #面积图
						//  Heiken Ashi = 8     #平均K线图
						//  Hollow Candles = 9  #空心K线图
						//  Renko = 4           #转形图
						//  Kagi = 5            #卡吉图
						//  Point&Figure = 6    #点数图
						//  Line Break = 7      #新价图
						"mainSeriesProperties.style": 1,
						"mainSeriesProperties.showCountdown": false,
						"scalesProperties.showSeriesLastValue": true,
						"mainSeriesProperties.visible": false,
						"mainSeriesProperties.showPriceLine": false,
						"mainSeriesProperties.priceLineWidth": 1,
						"mainSeriesProperties.lockScale": false,
						"mainSeriesProperties.minTick": "default",
						"mainSeriesProperties.extendedHours": false,
						"volumePaneSize": "tiny", //底部视图大小 支持的值: large, medium, small, tiny
						editorFontsList: ["Lato", "Arial", "Verdana", "Courier New", "Times New Roman"],
						"paneProperties.topMargin": 5,
						"paneProperties.bottomMargin": 5,
						"paneProperties.legendProperties.showLegend": true, //收起左上角指标
						"paneProperties.leftAxisProperties.autoScale": true,
						"paneProperties.leftAxisProperties.autoScaleDisabled": false,
						"paneProperties.leftAxisProperties.percentage": false,
						"paneProperties.leftAxisProperties.percentageDisabled": false,
						"paneProperties.leftAxisProperties.log": false,
						"paneProperties.leftAxisProperties.logDisabled": false,
						"paneProperties.leftAxisProperties.alignLabels": true,
						// "paneProperties.legendProperties.showStudyArguments": true,
						"paneProperties.legendProperties.showStudyTitles": true,
						"paneProperties.legendProperties.showStudyValues": true,
						"paneProperties.legendProperties.showSeriesTitle": false,
						"paneProperties.legendProperties.showSeriesOHLC": true, //开高低
						"scalesProperties.showLeftScale": false,
						"scalesProperties.showRightScale": true,
						"scalesProperties.backgroundColor": "#20334d",
						"scalesProperties.lineColor": "#46587b",
						"scalesProperties.textColor": "#8f98ad",
						"scalesProperties.scaleSeriesOnly": false,
						"mainSeriesProperties.priceAxisProperties.autoScale": true,
						"mainSeriesProperties.priceAxisProperties.autoScaleDisabled": false,
						"mainSeriesProperties.priceAxisProperties.percentage": false,
						"mainSeriesProperties.priceAxisProperties.percentageDisabled": false,
						"mainSeriesProperties.priceAxisProperties.log": false,
						"mainSeriesProperties.priceAxisProperties.logDisabled": false,
						"mainSeriesProperties.candleStyle.upColor": "#3fcfb4",
						"mainSeriesProperties.candleStyle.downColor": "#fe4761",
						"mainSeriesProperties.candleStyle.drawWick": true,
						"mainSeriesProperties.candleStyle.drawBorder": true,
						"mainSeriesProperties.candleStyle.borderColor": "#3fcfb4",
						"mainSeriesProperties.candleStyle.borderUpColor": "#3fcfb4",
						"mainSeriesProperties.candleStyle.borderDownColor": "#fe4761",
						"mainSeriesProperties.candleStyle.wickColor": "#737375",
						"mainSeriesProperties.candleStyle.wickUpColor": "#3fcfb4",
						"mainSeriesProperties.candleStyle.wickDownColor": "#fe4761",
						"mainSeriesProperties.candleStyle.barColorsOnPrevClose": false,
						"mainSeriesProperties.hollowCandleStyle.upColor": "#3fcfb4",
						"mainSeriesProperties.hollowCandleStyle.downColor": "#fe4761",
						"mainSeriesProperties.hollowCandleStyle.drawWick": true,
						"mainSeriesProperties.hollowCandleStyle.drawBorder": true,
						"mainSeriesProperties.hollowCandleStyle.borderColor": "#3fcfb4",
						"mainSeriesProperties.hollowCandleStyle.borderUpColor": "#3fcfb4",
						"mainSeriesProperties.hollowCandleStyle.borderDownColor": "#fe4761",
						"mainSeriesProperties.hollowCandleStyle.wickColor": "#737375",
						"mainSeriesProperties.hollowCandleStyle.wickUpColor": "#3fcfb4",
						"mainSeriesProperties.hollowCandleStyle.wickDownColor": "#fe4761",
						"mainSeriesProperties.haStyle.upColor": "#3fcfb4",
						"mainSeriesProperties.haStyle.downColor": "#fe4761",
						"mainSeriesProperties.haStyle.drawWick": true,
						"mainSeriesProperties.haStyle.drawBorder": true,
						"mainSeriesProperties.haStyle.borderColor": "#3fcfb4",
						"mainSeriesProperties.haStyle.borderUpColor": "#3fcfb4",
						"mainSeriesProperties.haStyle.borderDownColor": "#fe4761",
						"mainSeriesProperties.haStyle.wickColor": "#737375",
						"mainSeriesProperties.haStyle.wickUpColor": "#3fcfb4",
						"mainSeriesProperties.haStyle.wickDownColor": "#fe4761",
						"mainSeriesProperties.haStyle.barColorsOnPrevClose": false,
						"mainSeriesProperties.barStyle.upColor": "#3fcfb4",
						"mainSeriesProperties.barStyle.downColor": "#fe4761",
						"mainSeriesProperties.barStyle.barColorsOnPrevClose": false,
						"mainSeriesProperties.barStyle.dontDrawOpen": false,
						"mainSeriesProperties.lineStyle.color": "#0cbef3",
						"mainSeriesProperties.lineStyle.linestyle": 0,
						"mainSeriesProperties.lineStyle.linewidth": 1,
						"mainSeriesProperties.lineStyle.priceSource": "close",
						"mainSeriesProperties.areaStyle.color1": "#0cbef3",
						"mainSeriesProperties.areaStyle.color2": "#0098c4",
						"mainSeriesProperties.areaStyle.linecolor": "#0cbef3",
						"mainSeriesProperties.areaStyle.linestyle": 0,
						"mainSeriesProperties.areaStyle.linewidth": 1,
						"mainSeriesProperties.areaStyle.priceSource": "close",
						"mainSeriesProperties.areaStyle.transparency": 80
					},
					loading_screen: {
						backgroundColor: "#1e222d",
						foregroundColor: "#5d7d93",
					}
				});
			};

			window.addEventListener('DOMContentLoaded', initOnReady, false);
		</script>

	</head>
	<body style="margin:0px;">
		<div id="tv_chart_container"></div>
	</body>

</html>